#include <iostream>
using namespace std;

int main() 
{
	long long int X, Y, Z = 0;
	cin >> X >> Y;
	Z = (Y % X == 0 ? X + Y : Y - X);
	cout << Z << endl;
	return 0;
}
